package org.example.gateway.transfer;

import org.example.gateway.bean.AppInstance;
import org.example.gateway.pojo.vo.InstanceVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface InstanceVoTransfer {
    InstanceVoTransfer INSTANCE = Mappers.getMapper(InstanceVoTransfer.class);

    @Mappings({
            @Mapping(target = "createdTime", expression = "java(org.example.gateway.utils.DateUtil.formatDate(appInstance.getCreatedTime()))")
    })
    InstanceVo mapToVo(AppInstance appInstance);

    List<InstanceVo> mapToVos(List<AppInstance> appInstances);
}
